<!DOCTYPE html>
<html>

<head>
    <title>v-bind绑定标签元素属性实例</title>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0 " />
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
</head>

<body>
    <h1>v-bind绑定标签元素属性实例</h1>
    <hr>
    <div id="app">
        <img src="http://7xjyw1.com1.z0.glb.clouddn.com/weixinpingtai.jpg" width="200px" />
        <br>
        <img v-bind:src="imgSrc" width="200px" />
        <br>
        <hr>
        <a :href="webUrl" target="_blank">百度搜索</a>
        <hr>

        <div :class="className">1.绑定class
        </div>
        <div :class="{classA:isOk}">2.绑定class判断
        </div>
        <div :class="{classB:isOk}">3.绑定class判断
        </div>
        <div :class="[classA,classB]">4.绑定class中的数组</div>
        <div :class='isOk?classA:classB'>5.三元运算符</div>

        <hr>


        <div>
            <input type="checkbox" id="isOk" v-model="isOk">
            <label for="isOk">isOk={{isOk}}</label>
        </div>
        <hr>
        <div :style="{color:red,fontSize:font}">6.绑定style值</div>


        <div :style="styleObject">6.绑定style对象</div>
    </div>



    <style>
        .classA {
            color: red;
        }
        
        .classB {
            font-size: 150%;
        }
    </style>
    <script type="text/javascript">
        var app = new Vue({
            el: '#app',
            data: {
                imgSrc: 'http://7xjyw1.com1.z0.glb.clouddn.com/weixinpingtai.jpg',
                webUrl: 'http//www.baidu.com',
                className: 'classA',
                classA: 'classA',
                classB: 'classB',
                isOk: true,
                red: 'red',
                font: '20px',
                styleObject: {
                    color: 'green',
                    fontSize: '24px'
                }

            }

        })
    </script>
</body>

</html>